package com.zzb.projectfactory.framework.role.dao.mybatis;

import com.zzb.projectfactory.framework.role.entity.SysRole;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 权限mapper
 * Created by zhangzhenbin on 17-2-27.
 */
@Mapper
public interface SysRoleMapper {
    @Results(id = "SysRole", value = {
            @Result(property = "id", column = "id", id = true),
            @Result(property = "roleName", column = "role_name"),
            @Result(property = "roleCode", column = "role_code"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time"),
            @Result(property = "creator", column = "creator"),
            @Result(property = "updater", column = "updater"),
            @Result(property = "activate", column = "activate"),
    })
    @Select("select sys_role.* from sys_role inner join sys_role_user on sys_role_user.role_id = sys_role.id where sys_role_user.user_id = #{userId}")
    List<SysRole> findByUserId(@Param("userId") String userId);
}
